#!/usr/bin/env python2.7
# -*- conding: utf-8 -*-
# @Time : 2020/9/18 13:44
# @Author : mj
# @file : logmod.py.py
# @Project: python-script 

import logging
LOG_FORMAT = "%(asctime)s=====%(levelname)s++++++%(message)s"
logging.basicConfig(filename="/tmp/callback.log", level=logging.info, format=LOG_FORMAT)

def callback_log(log_string,log_level):
    if log_string == '':
        print "Error:the log_string must be have contents"
    if log_level == 'info':
        logging.info(log_string)
    elif log_level == 'warning':
        logging.warning(log_string)
    elif log_level == 'error':
        logging.error(log_string)
    else:
        logging.info(log_string)

log_string = "testtest"